import request from '@/utils/request'
const api_name = "/chapter"

export default {
    // 根据课程id获取课程大纲信息
    getTreeList(courseId) {
        return request({
            url: `${api_name}/treelist/${courseId}`,
            method: "get",
        })
    },
    //添加课程章节
    addChapter(chapter) {
        return request({
            url: `${api_name}`,
            method: "post",
            data: chapter
        })
    },
    // 根据id获取章节信息
    getChapter(id) {
        return request({
            url: `${api_name}/${id}`,
            method: 'get'
        })
    },
    // 更新API
    updateChapter(chapter) {
        return request({
            url: `${api_name}/${chapter.id}`,
            method: 'put',
            data: chapter
        })
    },
    //根据id删除章节
    deleteById(id) {
        return request({
            url: `${api_name}/${id}`,
            method: 'delete'
        })
    }
}